<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>编辑页面</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet">
    <link href="__PUBLIC__/css/font-awesome.css" rel="stylesheet">
    <link href="__PUBLIC__/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/css/style.css" rel="stylesheet">
    <link href="__PUBLIC__/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="__PUBLIC__/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
    <link href="__PUBLIC__/css/plugins/treeview/bootstrap-treeview.css" rel="stylesheet">
    <link href="__PUBLIC__/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="__PUBLIC__/css/bootstrap-editable.css" rel="stylesheet">
    <link href="__PUBLIC__/css/plugins/toastr/toastr.min.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeIn">
    <!--标题开始-->
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>修改项目<small class="m-l-sm">Now,开启你的投票之旅吧!</small></h5>
                </div>
            </div>
        </div>
    </div>
    <!--标题结束-->

    <!--选项卡开始-->
    <div class="row">
        <div class="col-sm-12">
            <div class="tabs-container" id="mytab">
                <ul class="nav nav-tabs">
                    <li class="active">
                        <a data-toggle="tab" href="#tab-1" aria-expanded="true">投票基本设置</a>
                    </li>
                    <li style="display:none;">
                        <a data-toggle="tab" href="#tab-2" aria-expanded="false">投票封面</a>
                    </li>
                    <li style="display:none;">
                    	<a data-toggle="tab" href="#tab-3" aria-expanded="false">投票模板</a>
                    </li>
                    <li style="display:none;">
                    	<a data-toggle="tab" href="#tab-4" aria-expanded="false">投票数据</a>
                    </li>
                    <li style="display:none;">
                        <a data-toggle="tab" href="#tab-5" aria-expanded="false">效果预览</a>
                    </li>
                </ul>
                <div class="tab-content">
                    <!--投票基本设置开始-->
                    <div id="tab-1" class="tab-pane active">
                        <div class="panel-body">
                            <h1 style="font-size: 20px;">投票基本设置</h1>
                            <form class="form-horizontal m-t" id="form1">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">投票名称：</label>
                                    <div class="col-sm-8">
                                        <input id="votename" name="votename" class="form-control" type="text" value="<{$res.votename}>">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">投票形式：</label>
                                    <div class="col-sm-8">
                                        <select class="form-control" name="voteway" id="voteway">
                                            <if condition="$res.voteway eq '1'">
                                                <option value="1" selected='selected'>每日限投N票(可重复投给一个人)</option>
                                                <option value="0">每日限投N票(不可重复投给一个人)</option>
                                           <else/>
                                                <option value="1">每日限投N票(可重复投给一个人)</option>
                                                <option value="0" selected='selected'>每日限投N票(不可重复投给一个人)</option>
                                            </if>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">票数设置：</label>
                                    <div class="col-sm-8">
                                        <input id="votenums" name="votenums" class="form-control" type="text" aria-required="true" aria-invalid="true" class="error"  value="<{$res.votenums}>">
										<span class="help-block m-b-none">
										<i class="fa fa-info-circle"></i>请输入投票形式下的票数，票数应该为正整数</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">投票开始时间：</label>
                                    <div class="col-sm-8">
                                        <input placeholder="开始日期" class="form-control layer-date" id="startime"  name="startime" type="text"  value="<{$res.startime}>">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">投票结束时间：</label>
                                    <div class="col-sm-8">
                                        <input placeholder="结束日期" class="form-control layer-date" id="endtime" name="endtime" type="text"  value="<{$res.endtime}>">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-8 col-sm-offset-3">
                                        <div class="checkbox">
                                            <label>
                                                <input type="checkbox" class="checkbox" id="agree" name="agree"> 我已经认真阅读并同意投票项目注意事项
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-8 col-sm-offset-3">
                                        <button class="btn btn-info" type="submit">保存基本配置进入下一步</button>
                                    </div>
                                </div>
                            </form>
                            <div style="height: 10px;"></div>
                        </div>
                    </div>
                    <!--投票基本设置结束-->

                    <!--投票封面开始-->
                    <div id="tab-2" class="tab-pane">
                        <div class="panel-body">
                            <h1 style="font-size: 20px;">投票封面</h1>
                            <form class="form-horizontal m-t" id="form2" enctype="multipart/form-data">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">投票封面：</label>
                                    <div class="col-sm-8">
                                        <label for="doc1">
                                            <img id="preview1" src = "<{$res.homepic}>&<{:rand()}>" style="display:block;width: 130px;height: 130px;"/>
                                        </label>
                                        <input  id="doc1"  name="file2" type="file" onchange="javascript:setImagePreview(1);" style="position:absolute;clip:rect(0 0 0 0);" id="file2">
                                        <input type="hidden" name="isimg" value="<{$res.homepic}>"  id="isimg1" class="form-control"  />
                                        <span class="help-block m-b-none">
                                        	<i class="fa fa-info-circle"></i>请在此配置投票项目封面，作为微信图文消息的封面图
										</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">封面描述：</label>
                                    <div class="col-sm-8">
                                        <textarea class="form-control" rows="3" id="picdes" name="picdes" ><{$res.picdes}></textarea>
                                         <span class="help-block m-b-none">
										 <i class="fa fa-info-circle"></i>封面描述作为微信图文消息中的描述文字</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="form-group">
                                        <div class="col-sm-8 col-sm-offset-3" style="margin-top: 10px;">
                                            <div class="alert alert-danger" id="warncnt">警告信息</div>
                                        </div>
                                        <div class="col-sm-8 col-sm-offset-3">
                                            <button class="btn btn-info" type="submit">保存封面配置进入下一步</button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!--投票封面结束-->

                    <!--投票模板和投票规则的设定开始-->
                    <div id="tab-3" class="tab-pane">
                        <div class="panel-body">
                            <h1 style="font-size: 20px;">投票模板选择</h1>
                            <form class="form-horizontal m-t" id="form3">
                                <!--选择模板-->
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">选择模板：</label>
                                    <div class="col-sm-8">
                                        <select class="form-control" name="templateid" onchange="setImg()" id="templateid">
                                            <if condition="$res.templetid eq '模板一'">
                                                <option value="模板一" selected='selected'>模板一</option>
                                                <option value="模板二">模板二</option>
                                                <option value="模板三">模板三</option>
                                                <option value="模板四">模板四</option>
                                            <elseif condition="$res.templetid eq '模板二'"/>
                                                <option value="模板一">模板一</option>
                                                <option value="模板二" selected='selected'>模板二</option>
                                                <option value="模板三">模板三</option>
                                                <option value="模板四">模板四</option>
                                            <elseif  condition="$res.templetid eq '模板三'"/>
                                                <option value="模板一">模板一</option>
                                                <option value="模板二">模板二</option>
                                                <option value="模板三" selected='selected'>模板三</option>
                                                <option value="模板四">模板四</option>
                                            <else/>
                                                <option value="模板一">模板一</option>
                                                <option value="模板二">模板二</option>
                                                <option value="模板三" >模板三</option>
                                                <option value="模板四" selected='selected'>模板四</option>
                                            </if>
                                        </select>
                                    </div>
                                </div>
                                <!--选择模板-->

                                <!--样式模板-->
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">样式模板：</label>
                                    <div class="col-sm-8">
                                        <if condition="$res.templetid eq '模板一'">
                                            <img id="template_img" src="__PUBLIC__/img/mb1.png" style="display:block;width: 250px;height: 350px;"/>
                                        <elseif  condition="$res.templetid eq '模板二'"/>
                                            <img id="template_img" src=" __PUBLIC__/img/mb2.png" style="display:block;width: 250px;height: 350px;"/>
                                        <elseif  condition="$res.templetid eq '模板三'"/>
                                            <img id="template_img" src=" __PUBLIC__/img/mb3.png" style="display:block;width: 250px;height: 350px;"/>
                                        <else/>
                                            <img id="template_img" src=" __PUBLIC__/img/mb4.png" style="display:block;width: 250px;height: 350px;"/>
                                        </if>
                                    </div>
                                </div>
                                <!--样式模板-->

                                <!--投票规则-->
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">投票规则：</label>
                                    <div class="col-sm-8">
                                        <div class="summernote" name="voterule">
                                           <{$res.voterule}>
                                        </div>
                                    </div>
                                </div>
                                <!--投票规则-->

                                <!--提交-->
                                <div class="form-group">
                                    <div class="col-sm-8 col-sm-offset-3" style="margin-top: 10px;">
                                        <div class="alert alert-success" id="warncnt3">警告信息</div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-8 col-sm-offset-3">
                                            <button class="btn btn-info" type="submit">保存模板配置进入下一步</button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!--投票模板和投票规则的设定结束-->

					<!-- 添加投票数据开始  -->
					<div id="tab-4" class="tab-pane">
						<div class="panel-body">
							<div class="col-sm-12">
                                 <!--主体内容开始-->
                                 <div class="ibox-content" style="border-top-width: 0px;">
                                     <!--树形列表开始-->
                                     <div class="col-sm-3">
                                         <div id="treeview11" class="test"></div>
                                     </div>
                                     <!--树形列表结束-->
                                     
                                     <div class="col-sm-9">
                                         <!--投票人隐藏图标-->
                                         <div class="btn-group " id="toolbar" role="group" style="display: none;padding-bottom: 5px;">
                                             <button type="button" class="btn btn-outline btn-default" data-toggle="modal" data-target="#addTpr">
                                                 <i class="glyphicon glyphicon-plus" aria-hidden="true">添加人员</i>
                                             </button>
                                             <button type="button" class="btn btn-outline btn-default">
                                                 <i class="glyphicon glyphicon-upload" aria-hidden="true">上传excel</i>
                                             </button>
                                         </div>
                                         
                                         <!--候选人隐藏图标-->
                                         <div class="btn-group " id="toolbar2" role="group" style="display: none;bottom: 5px;">
                                             <button type="button" class="btn btn-outline btn-default" onclick="addHxr()">
                                                 <i class="glyphicon glyphicon-plus" aria-hidden="true">添加人员</i>
                                             </button>
                                         </div>
                                         <input type="hidden" id="iswhich" value=""/>
                                        
                                         <!--投票人表格-->
                                         <table data-toggle="table" id = "tabletpr">
                                             <thead>
                                              <tr>
                                                  <th data-field="tuid">编号</th>
                                                  <th data-field="personame">姓名</th>
                                                  <th data-field="department">部门</th>
                                                  <th data-field="joinflag">身份标识</th>
                                                  <th data-field="daynums">已投票数</th>
                                                  <th data-field="status">投票人资格</th>
                                                  <th data-field="operation" data-formatter="actionFormatter" data-events="actionEvents">操作</th>
                                              </tr>
                                             </thead>
                                         </table>
                                         
                                         <!--候选人表格-->
                                         <table data-toggle="table" id="tablehxr" style="display: none">
                                             <thead>
                                              <tr>
                                                  <th data-field="huid">编号</th>
                                                  <th data-field="perpic">图片</th>
                                                  <th data-field="personame">姓名</th>
                                                  <th data-field="department">部门</th>
                                                  <th data-field="joinflag">身份标识</th>
                                                  <th data-field="brifintro">简介</th>
                                                  <th data-field="daynums">获得票数</th>
                                                  <th data-field="lables">标签</th>
                                                  <th data-field="status">候选人资格</th>
                                                  <th data-field="operation" data-formatter="actionFormatter" data-events="actionEvents">操作</th>
                                              </tr>
                                             </thead>
                                         </table>
                                     </div>
                                     <div class="clearfix"></div>
                                 </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-8 col-sm-offset-3">
                                    <button class="btn btn-info" id="effect">预览效果</button>
                                </div>
                            </div>
						</div>
					</div>
					<!-- 添加投票数据结束  -->

                    <!--效果预览图开始-->
                    <div id="tab-5" class="tab-pane">
                        <div class="panel-body">
                            <div style='float:left;background: url("__PUBLIC__/img/phone.png") no-repeat 0 0; background-size:350px 697px;width: 350px;height: 687px; position: relative;padding:94px 36px 98px 36px;'>
                                <iframe id="iframe" frameborder="0" src="/tpb/Home/Index/index/proid/<{$res.proid}>"  style="width:280px;height:506px;"></iframe>
                            </div>
                            <div style="float: left;margin-top: 15px;margin-left: 36px;">
                                <div>
                                    <img src="<{$res.qrcode}>" style="width: 344px;height: 344px;"/>
                                </div>
                                <div style="text-align: center;margin-top: 10px;">扫描二维码进入投票页面</div>
                            </div>
                        </div>
                    </div>
                    <!--效果预览图结束-->
                </div>
            </div>
        </div>
    </div>
    <!--选项卡结束-->
</div>


<!--增加候选人-->
<div class="modal fade" id="addHxr" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">增加候选人</h4>
            </div>
            <!--增加投票人信息表单-->
            <div class="modal-body">
                <form class="form-horizontal" role="form" id="addHxrForm">
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">姓名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control"  name="personame" placeholder="请输入名字" id="personame2">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">标识</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="joinflag" placeholder="请输入候选人身份验证" id="joinflag2">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">部门</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="department" placeholder="请输入所在部门" id="department2">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">资格</label>
                        <div class="col-sm-10">
                            <select class="form-control" name="status" >
                                <option value="1">拥有候选人资格</option>
                                <option value="0">没有候选人资格</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">照片</label>
                        <div class="col-sm-10">
                            <label for="doc2">
                                <img id="preview2" src="__PUBLIC__/img/up2.png" style="display:block;width: 130px;height: 130px;"/>
                            </label>
                            <input  id="doc2"  name="file2" type="file" onchange="javascript:setImagePreview(2);" style="position:absolute;clip:rect(0 0 0 0);">
                            <input type="hidden" name="isimg" value=""  id="isimg2" class="form-control"  />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">简介</label>
                        <div class="col-sm-10">
                           <textarea class="form-control" name="brifintro" row="2" id="brifintro2"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">特点</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="lables" id="lables2" placeholder="请候选人特点或标签">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-10 col-sm-offset-2">
                            <div class="alert alert-danger" id="warnhxr">警告信息</div>
                        </div>
                        <div class="col-sm-offset-4 col-sm-10">
                            <button type="submit" class="btn btn-default">确认添加</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!--增加候选人结束-->

<!--编辑候选人开始-->
<div class="modal fade" id="editHxr" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">编辑候选人</h4>
            </div>
            <!--编辑候选人信息表单-->
            <div class="modal-body">
                <form class="form-horizontal" role="form" id="editHxrForm">
                    <input type="hidden" value="" name="huid" id="hxrid3"/>
                    <!--名字-->
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">姓名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control"  name="personame" placeholder="请输入名字" id="personame3">
                        </div>
                    </div>
                    <!--标识-->
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">标识</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="joinflag" placeholder="请输入候选人身份验证" id="joinflag3">
                        </div>
                    </div>
                    <!--部门-->
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">部门</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="department" placeholder="请输入所在部门" id="department3">
                        </div>
                    </div>
                    <!--资格-->
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">资格</label>
                        <div class="col-sm-10">
                            <select class="form-control" name="status" id="status3">
                                <option value="1">拥有候选人资格</option>
                                <option value="0">没有候选人资格</option>
                            </select>
                        </div>
                    </div>
                    <!--照片-->
                    <div class="form-group">
                        <label class="col-sm-2 control-label">照片</label>
                        <div class="col-sm-10">
                            <label for="doc3">
                                <img id="preview3" src="__PUBLIC__/img/up2.png" style="display:block;width: 130px;height: 130px;"/>
                            </label>
                            <input id="doc3"  name="file2" type="file" onchange="javascript:setImagePreview(3);" style="position:absolute;clip:rect(0 0 0 0);">
                            <input type="hidden" name="isimg" value=""  id="isimg3" class="form-control"/>
                        </div>
                    </div>
                    <!--简介-->
                    <div class="form-group">
                        <label class="col-sm-2 control-label">简介</label>
                        <div class="col-sm-10">
                            <textarea class="form-control" name="brifintro" row="2" id="brifintro3"></textarea>
                        </div>
                    </div>
                    <!--获得票数-->
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">获得票数</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="daynums" id="daynums3" placeholder="获得票数">
                        </div>
                    </div>
                    <!--特点-->
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">特点</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="lables" id="lables3" placeholder="请候选人特点或标签">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-10 col-sm-offset-2">
                            <div class="alert alert-danger" id="warnhxr3">警告信息</div>
                        </div>
                        <div class="col-sm-offset-5 col-sm-10">
                            <button type="submit" class="btn btn-default">确认修改</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!--编辑候选人结束-->

<!--增加投票人开始-->
<div class="modal fade" id="addTpr" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">增加投票人</h4>
            </div>
            <!--增加投票人信息表单-->
            <div class="modal-body">
                <form class="form-horizontal" role="form" id="addTprForm">
                    <input type="hidden" id="info" value="" name="info" >
                    <div class="form-group">
                        <label for="personame" class="col-sm-2 control-label">姓名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="personame" name="personame" placeholder="请输入名字">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="joinflag" class="col-sm-2 control-label">标识</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="joinflag" name="joinflag" placeholder="请输入投票人身份验证">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="department" class="col-sm-2 control-label">部门</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="department" name="department" placeholder="请输入所在部门">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">资格</label>
                        <div class="col-sm-10">
                            <select class="form-control" name="status"  id="status">
                                <option value="1">拥有投票人资格</option>
                                <option value="0">禁止投票</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-10 col-sm-offset-2">
                            <div class="alert alert-danger" id="warntpr">警告信息</div>
                        </div>
                        <div class="col-sm-offset-4 col-sm-10">
                            <button type="submit" class="btn btn-default">确认添加</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!--增加投票人结束-->

<!--编辑投票人开始-->
<div class="modal fade" id="editTpr" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">编辑投票人</h4>
            </div>
            <!--编辑投票人信息表单-->
            <div class="modal-body">
                <form class="form-horizontal" role="form" id="editTprForm">
                    <input type="hidden" value="" name="tuid" id="tprid"/>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">姓名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="personame4" name="personame" placeholder="请输入名字">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">标识</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="joinflag4" name="joinflag" placeholder="请输入投票人身份验证">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">部门</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="department4" name="department" placeholder="请输入所在部门">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">已投票数</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="daynums4" name="daynums" placeholder="已经投过的票数">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">资格</label>
                        <div class="col-sm-10">
                            <select class="form-control" name="status"  id="status4">
                                <option value="1">拥有投票人资格</option>
                                <option value="0">禁止投票</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-10 col-sm-offset-2">
                            <div class="alert alert-danger" id="warntpr4">警告信息</div>
                        </div>
                        <div class="col-sm-offset-5 col-sm-10">
                            <button type="submit" class="btn btn-default">确认修改</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!--编辑投票人结束-->

<!-- 全局js -->
<script src="__PUBLIC__/js/jquery.min.js"></script>
<script src="__PUBLIC__/js/bootstrap.min.js"></script>

<!-- 自定义js -->
<script src="__PUBLIC__/js/content.js"></script>

<!-- Bootstrap-Treeview plugin javascript -->
<script src="__PUBLIC__/js/plugins/treeview/bootstrap-treeview.js"></script>

<!-- Bootstrap table -->
<script src="__PUBLIC__/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="__PUBLIC__/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="__PUBLIC__/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>

<script src="__PUBLIC__/js/bootstrap-editable.js"></script>
<script src="__PUBLIC__/js/plugins/toastr/toastr.min.js"></script>

<!-- jQuery Validation plugin javascript-->
<script src="__PUBLIC__/js/plugins/validate/jquery.validate.min.js"></script>
<script src="__PUBLIC__/js/plugins/validate/messages_zh.min.js"></script>
<script src="__PUBLIC__/js/demo/form-validate-demo.js"></script>

<!--引入日期-->
<script src="__PUBLIC__/js/plugins/layer/laydate/laydate.js"></script>

<!-- SUMMERNOTE -->
<script src="__PUBLIC__/js/plugins/summernote/summernote.min.js"></script>
<script src="__PUBLIC__/js/plugins/summernote/summernote-zh-CN.js"></script>

<!--引入关于form表单的ajax提交-->
<script src="__PUBLIC__/js/jquery.form.min.js"></script>
<script type="text/javascript">
    <!--预览图片-->
    function setImagePreview(id) {
        var docObj=document.getElementById("doc"+id);
        var imgObjPreview=document.getElementById("preview"+id);
        if(docObj.files &&docObj.files[0])
        {
            //火狐下，直接设img属性
            imgObjPreview.style.display = 'block';
            imgObjPreview.style.width = '130px';
            imgObjPreview.style.height = '130px';
            //imgObjPreview.src = docObj.files[0].getAsDataURL();

            //火狐7以上版本不能用上面的getAsDataURL()方式获取，需要一下方式
            imgObjPreview.src = window.URL.createObjectURL(docObj.files[0]);
        }
        else
        {
            //IE下，使用滤镜
            docObj.select();
            var imgSrc = document.selection.createRange().text;
            var localImagId = document.getElementById("localImag");
            //必须设置初始大小
            localImagId.style.width = "130px";
            localImagId.style.height = "130px";
            //图片异常的捕捉，防止用户修改后缀来伪造图片
            try{
                localImagId.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
                localImagId.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgSrc;
            }
            catch(e)
            {
                alert("您上传的图片格式不正确，请重新选择!");
                return false;
            }
            imgObjPreview.style.display = 'none';
            document.selection.empty();
        }
        $("#isimg"+id).val("true");
        return true;
    }

    <!-- 项目基本信息更新  -->
    
    //日期范围限制
    var start = {
        elem: '#startime',
        format: 'YYYY-MM-DD hh:mm:ss',
        min: laydate.now(), //设定最小日期为当前日期
        max: '2099-06-16 23:59:59', //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas; //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#endtime',
        format: 'YYYY-MM-DD hh:mm:ss',
        min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
    
    //根据选择的模板，设置模板样式图片
    function  setImg(){
        var i= $("#templateid option:selected").val();
        if(i==="模板一"){
            $("#template_img").attr("src","__PUBLIC__/img/mb1.png");
        }else if (i=="模板二"){
            $("#template_img").attr("src","__PUBLIC__/img/mb2.png");
        }else if (i=="模板三"){
            $("#template_img").attr("src","__PUBLIC__/img/mb3.png");
        }else if (i=="模板四"){
            $("#template_img").attr("src","__PUBLIC__/img/mb4.png");
        }
    }

    $(document).ready(function () {
        $("#warncnt").hide();
        $("#warncnt3").hide();
        $('.summernote').summernote({
            toolbar: [
                ['style', ['bold', 'italic', 'underline', 'clear']],
                ['fontsize', ['fontsize']],
                ['fontname',['fontname']],
                ['para', ['ul', 'ol', 'paragraph']],
            ],
            lang: 'zh-CN',
            height:200,

        });
        // validate signup form on keyup and submit
        var icon = "<i class='fa fa-times-circle'></i> ";
        $("#form1").validate({
            rules: {
                votename: "required",
                votenums: {
                    required: true,
                    digits:true,
                    min:1
                },
                startime: {required: true,},
                agree: "required"
            },
            messages: {
                votename: icon + "请输入项目名称！",
                votenums: {
                    required: icon + "请输入正确票数",
                    digits: icon + "请输入正确票数",
                    min:icon + "输入的票数应不小于1",
                },
                startime: {required: icon + "请输入项目开始时间",},
                agree: {
                    required: icon + "必须同意协议后才能创建投票项目",
                    element: '#agree-error'
                }
            },
            submitHandler: function(form) {
                $('#mytab li:eq(1) a').tab('show');
                $('#mytab li.active').show();
                return false;
            }
        });

        //第二个表单
        $("#form2").validate({
            rules: {picdes: "required",},
            messages: {picdes: icon + "请输入封面描述",},
            submitHandler: function(form) {
                $(form).ajaxSubmit({
                    url: "<{:U('Vote/updateImg',array('proid'=>$res['proid']))}>",
                    type: "post",
                    dataType: 'json',
                    enctype: 'multipart/form-data',
                    success: function (data) {
                        if (data['status']) {
                            $("#warncnt").hide();
                            $('#mytab li:eq(2) a').tab('show');
                            $('#mytab li.active').show();
                        } else {
                            $("#warncnt").html(data['info']);
                            $("#warncnt").show();
                        }
                    }
                });
            }
        });
        //第三个表单
        $("#form3").validate({
            rules: {voterule:"required",},
            messages: {voterule:icon + "请输入编写投票规则",},
            submitHandler: function(form) {
                $(form).ajaxSubmit({
                    url: "<{:U('Vote/saveUpdate')}>",
                    type: "post",
                    data:{
                        'proid':"<{$res.proid}>",
                        'votename':$("#votename").val(),
                        'voteway':$("#voteway option:selected").val(),
                        'votenums':$("#votenums").val(),
                        'startime':$("#startime").val(),
                        'endtime':$("#endtime").val(),
                        'picdes':$("#picdes").val(),
                        'templateid':$("#templateid option:selected").val(),
                        'voterule':$(".summernote").code()
                    },
                    dataType:'json',
                    success: function (data)
                    {	
                        if(data['status']){
                        	$('#iframe').attr('src', $('#iframe').attr('src'));
                            $("#warncnt3").html(data['info']);
                            $("#warncnt3").show();
                            treedata = [{"text":data['content']['votename'],"nodes":[{"text":"候选人信息","tags":["hxr"+data['content']['proid']]},{"text":"投票人信息","tags":["tpr"+data['content']['proid']]}]}];
                            treeView(treedata);
                            setTimeout(function(){
                                $('#mytab li:eq(3) a').tab('show');
                                $('#mytab li.active').show();
                            },500);
                        }else{
                            $("#warncnt3").html(data['info']);
                            $("#warncnt3").show();
                        }
                    }
                });
                return false;
            }
        });
        $('#effect').click(function(){
        	 $('#iframe').attr('src', $('#iframe').attr('src'));
        	 $('#mytab li:eq(4) a').tab('show');
             $('#mytab li.active').show();
        });
    });
    
    
    <!-- 项目投票数据信息更新  -->
    //打开候选人弹出框
    function addHxr() {
        $("#preview2").attr("src","__PUBLIC__/img/up2.png");
        $("#addHxr").modal('show');
    }
   
    var API_URL = "<{:U('Person/getPerByProid')}>";
    var $tabletpr = $('#tabletpr').bootstrapTable({url: API_URL});
    var $tablehxr = $('#tablehxr').bootstrapTable({url: API_URL});

    function treeView(treedata) {
    	$('#treeview11').treeview({
            color: "#428bca",
            data:  treedata,
            onNodeSelected: function (event, node) { 
                var values = node.tags[0];
                $("#iswhich").val(values);
                if (values.indexOf("hxr") >=0 ) {
                	$("#toolbar").hide();
                	$("#tabletpr").hide();
                    $("#toolbar2").show();
                    $("#tablehxr").show();
                } else {
                	$("#toolbar2").hide();
                    $("#tablehxr").hide();
                    $("#info").val(values);
                    $("#toolbar").show();
                    $("#tabletpr").show();
                }
                $.ajax({
                    url: "<{:U('Person/getPerByProid')}>",
                    type: 'GET',
                    data: {"id":node.tags},
                    success: function (data2) {
                        if(values.indexOf("hxr") >=0 ) {
                            $tablehxr.bootstrapTable('load',data2);
                        } else {
                            $tabletpr.bootstrapTable('load',data2);
                        }
                    }, error: function () {
                        toastr.error('哎呀呀！加载出现错误了，请稍后重试', 1500);
                    }
                });
            }
        });
	}
    function actionFormatter(value, row, index) {
        return '<a href="#" class="update" >修改</a> ' + '<a href="#" class="delete">删除</a>';
    }
    window.actionEvents = {
         'click .update': function (e, value, row) {
             var tmp=""+$("#iswhich").val();
             if (tmp.indexOf("hxr")>=0){
                 $("#hxrid3").val(row.huid);
                 $("#personame3").val(row.personame);
                 $("#department3").val(row.department);
                 $("#joinflag3").val(row.joinflag);
                 $("#daynums3").val(row.daynums);
                 $("#brifintro3").val(row.brifintro);
                 $("#lables3").val(row.lables);
                 $("#preview3").attr("src",row.perpic+'&'+ Math.random());
                 $("#status3 option").removeAttr("selected"); //移除属性selected
                 if(row.status == '有') {
                     $("#status3").find("option[value='1']").attr("selected",true);
                 }else{
                     $("#status3").find("option[value='0']").attr("selected",true);
                 }
                 $("#warnhxr3").hide();
                 $('#editHxr').modal('show');
             }else{
                 $("#tprid").val(row.tuid);
                 $("#personame4").val(row.personame);
                 $("#department4").val(row.department);
                 $("#joinflag4").val(row.joinflag);
                 $("#daynums4").val(row.daynums);
                 $("#status4 option").removeAttr("selected"); //移除属性selected
                 if(row.status == '有'){
                     $("#status4").find("option[value='1']").attr("selected",true);
                 }else{
                     $("#status4").find("option[value='0']").attr("selected",true);
                 }
                 $("#warntpr4").hide();
                 $('#editTpr').modal('show');
             }
         },
         'click .delete': function (e, value, row) {
             if (confirm('确定删除该记录吗?')) {
             	var iswhich = "" + $("#iswhich").val();
             	if ( iswhich.indexOf("hxr") >=0 ) {
             		var uid = 'huid';
             	    var uidVal = row.huid;
             	} else {
             		var uid = 'tuid';
             		var uidVal = row.tuid;
             	}
             	var data = {};
             	data[uid] = uidVal;
             	data['iswhich'] = iswhich;
                 $.ajax({
                     url: "<{:U('Person/deletePer')}>",
                     type: 'POST',
                     data: data,
                     success: function (data) {
                         if (data['status']) {
                             var tmp=""+$("#iswhich").val();
                             var str="<{:U('Person/getPerByProid')}>?id="+tmp;
                             if (tmp.indexOf("hxr")>=0){
                                 $("#tablehxr").bootstrapTable("refresh",{'url':str});
                             }else{
                                 $("#tabletpr").bootstrapTable("refresh",{'url':str});
                             }
                             toastr.success('恭喜您，删除成功!',1500);
                         }
                     }, error: function () {
                         toastr.error('哎呀呀！出现异常啦，删除失败，请稍后重试', 1500);
                     }
                 })
             }
         }
     }
    // 项目数据处理
    $(document).ready(function () {
        toastr.options.positionClass = 'toast-top-center';
        $('#tabletpr').bootstrapTable('hideColumn', 'tuid');
        $('#tablehxr').bootstrapTable('hideColumn', 'huid');
        $('#tablehxr').bootstrapTable('hideColumn', 'perpic');
        $("#warntpr").hide();
        $("#warntpr4").hide();
        $("#warnhxr").hide();
        $("#warnhxr3").hide();
        var icon = "<i class='fa fa-times-circle'></i> ";
        //增加投票人表单验证
        $("#addTprForm").validate({
            rules: {
                personame: "required",
                joinflag: "required",
                department: "required",
            },
            messages: {
                personame: icon + "请输入投票人姓名！",
                joinflag: icon + "请输入投票人身份验证！",
                department: icon + "请输入投票人所在部门！",
            },
            submitHandler: function(form) {
                $(form).ajaxSubmit({
                    url: "<{:U('Person/addTpr')}>",
                    type: "post",
                    dataType:'json',
                    success: function (data)
                    {
                         if(data['status']){
                             $("#warntpr").hide();
                             $("#addTpr").modal('hide');
                             var str="<{:U('Person/getPerByProid')}>?id="+$("#info").val();
                             $("#tabletpr").bootstrapTable("refresh",{'url':str});
                             $("#joinflag").val("");
                             $("#personame").val("");
                             $("#department").val("");
                         }else {
                             $("#warntpr").html(data['info']);
                             $("#warntpr").show();
                         }
                    }
                });
                return false;
            }
        });
        //增加候选人表单
        $("#addHxrForm").validate({
            rules: {
                personame: "required",
                joinflag: "required",
                department: "required",
                brifintro: "required",
                isimg:"required",
            },
            messages: {
                personame: icon + "请输入候选人姓名！",
                joinflag: icon + "请输入候选人身份验证！",
                department: icon + "请输入候选人所在部门！",
                brifintro:icon + "请输入候选人简介！",
                isimg:  icon + "请上传候选人照片",
            },
            submitHandler: function(form) {
                $(form).ajaxSubmit({
                    url: "<{:U('Person/addHxr')}>",
                    type: "post",
                    enctype: 'multipart/form-data',
                    dataType:'json',
                    data:{
                        'iswhich':$("#iswhich").val()
                    },
                    success: function (data)
                    {
                        if(data['status']){
                            $("#warnhxr").hide();
                            $("#addHxr").modal('hide');
                            var str="<{:U('Person/getPerByProid')}>?id="+$("#iswhich").val();
                            $("#tablehxr").bootstrapTable("refresh",{'url':str});
                            $("#personame2").val("");
                            $("#joinflag2").val("");
                            $("#brifintro2").val("");
                            $("#department2").val("");
                            $("#lables2").val("");
                        }else {
                            $("#warnhxr").html(data['info']);
                            $("#warnhxr").show();
                        }
                    }
                });
                return false;
            }
        });
        
        //编辑投票人表单验证
        $("#editTprForm").validate({
            rules: {
                personame: "required",
                joinflag: "required",
                department: "required",
                daynums:"required",
            },
            messages: {
                personame: icon + "请输入投票人姓名！",
                joinflag: icon + "请输入投票人身份验证！",
                department: icon + "请输入投票人所在部门！",
                daynums:icon + "请输入已投票数！",
            },
            submitHandler: function(form) {
                $(form).ajaxSubmit({
                    url: "<{:U('Person/updateTpr')}>",
                    type: "post",
                    data:{
                      'iswhich':$("#iswhich").val()
                    },
                    dataType:'json',
                    success: function (data)
                    {
                        if(data['status']){
                            $("#warntpr4").hide();
                            $("#editTpr").modal('hide');
                            var str="<{:U('Person/getPerByProid')}>?id="+$("#iswhich").val();
                            $("#tabletpr").bootstrapTable("refresh",{'url':str});
                            toastr.success('编辑投票人成功!',1500);
                        }else {
                            $("#warntpr4").html(data['info']);
                            $("#warntpr4").show();
                        }
                    }
                });
                return false;
            }
        });

        //编辑候选人表单验证
        $("#editHxrForm").validate({
            rules: {
                personame: "required",
                joinflag: "required",
                department: "required",
                daynums:"required",
                brifintro:"required",
            },
            messages: {
                personame: icon + "请输入候选人姓名！",
                joinflag: icon + "请输入候选人身份验证！",
                department: icon + "请输入候选人所在部门！",
                daynums:icon + "请输入获得票数！",
                brifintro:icon + "请输入候选人简介！",
            },
            submitHandler: function(form) {
                $(form).ajaxSubmit({
                    url: "<{:U('Person/updateHxr')}>",
                    type: "post",
                    data:{
                        'iswhich':$("#iswhich").val()
                    },
                    dataType:'json',
                    success: function (data)
                    {
                        if(data['status']){
                            $("#warnhxr3").hide();
                            $("#editHxr").modal('hide');
                            var str="<{:U('Person/getPerByProid')}>?id="+$("#iswhich").val();
                            $("#tablehxr").bootstrapTable("refresh",{'url':str});
                            toastr.success('编辑候选人成功!',1500);
                        }else {
                            $("#warnhxr3").html(data['info']);
                            $("#warnhxr3").show();
                        }
                    }
                });
                return false;
            }
        });
    });
</script>
</body>
</html>